/****************************************************************
 *  YAG2002 (http://yag2002.sourceforge.net)
 *  Copyright (C) 2005-2006, A. Botorabi
 *
 *  This program is free software; you can redistribute it and/or 
 *  modify it under the terms of the GNU Lesser General Public 
 *  License version 2.1 as published by the Free Software Foundation.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public 
 *  License along with this program; if not, write to the Free 
 *  Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
 *  MA  02111-1307  USA
 * 
 ****************************************************************/

/*###############################################################
 # player's mail view gui implementation
 #
 #   date of creation:  01/08/2008
 #
 #   author:            boto (botorabi at users.sourceforge.net) 
 #
 ****************************************************************/

#ifndef _VRC_MAILBOXGUIVIEW_H_
#define _VRC_MAILBOXGUIVIEW_H_

#include <vrc_main.h>
#include <storage/vrc_mailboxclient.h>

namespace vrc
{

class MailboxGui;

//! Class for player's mailbox view gui
class MailboxGuiView : public MailboxResponseCallback
{
    public:

        //! Construct the main gui given the gui file name.
                                                    MailboxGuiView( MailboxGuiMain* p_mailbox, const std::string& filename );

        virtual                                     ~MailboxGuiView();

        //! Get the frame object
        CEGUI::FrameWindow*                         getFrame();

        //! View the mail with given ID.
        void                                        viewMail( unsigned int mailID );

    protected:

        //! Setup the GUI
        void                                        setupGui( const std::string& filename );

        //! Callback: Get the user ID the mailbox belongs to.
        unsigned int                                mailboxGetUserID() const;

        //! Callback: Get the mailbox request response. The response string and status are generated by the mail server.
        void                                        mailboxResponse( const MailboxContent& mailcontent, unsigned int status, const std::string& response );

        //! Callback for on-close event
        bool                                        onClickedClose( const CEGUI::EventArgs& arg );

        //! Main gui object
        MailboxGuiMain*                             _p_mailboxGuiMain;

        //! Frame object
        CEGUI::FrameWindow*                         _p_frame;

        //! Gui elements
        CEGUI::Editbox*                             _p_editboxTo;
        CEGUI::Editbox*                             _p_editboxCC;
        CEGUI::Editbox*                             _p_editboxSubject;
        CEGUI::MultiLineEditbox*                    _p_editboxBody;
};

} // namespace vrc

#endif // _VRC_MAILBOXGUIVIEW_H_
